package com.xinyu.cli.command;

import cn.hutool.core.io.FileUtil;
import picocli.CommandLine;

import java.io.File;
import java.util.List;

/**
 * list 子命令
 * 遍历输出所有要生成代码的**文件列表**
 *
 * @author: Wuxinyu
 * @date: 2024/5/19-05-19-16:25
 * @description: com.xinyu.cli.command
 * @version: 1.0
 */
@CommandLine.Command(name = "list", description = "查看文件列表", mixinStandardHelpOptions = true)
public class ListCommand implements Runnable{
    public void run() {
        // 当前打开的窗口
        String projectPath = System.getProperty("user.dir");
        // 输入路径 ACM的示例模板 在 code-generator-demo-projects 目录下
        String inputPath = new File(projectPath + File.separator + "code-generator-demo-projects/acm-template").getAbsolutePath();
        List<File> files = FileUtil.loopFiles(inputPath);
        for (File file : files) {
            // 打印文件信息
            System.out.println(file);
        }
    }
}
